package com.itheima.网络编程.tcp编程.tcp编程.tcp网络编程;

import java.io.IOException;
import java.io.OutputStream;
import java.net.Socket;
import java.util.Scanner;

public class TcpDemo2 {
    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        Socket sk = new Socket("127.0.0.1", 10022);
        while (true) {
            OutputStream outputStream = sk.getOutputStream();

            String message = sc.next();
            outputStream.write(message.getBytes());
            outputStream.close();
//            sk.close();
            outputStream.close();
        }
    }
}
